/*
*************************************************************************
*西瑞克斯研发管理系统
*版 本: 1.0   
*日 期：02/11/2012    
*作 者： 王浩 QQ：873987060   
*************************************************************************   
*/ 
package com.manager.workflow.core;

import org.apache.commons.lang.StringUtils;

import com.manager.workflow.WorkFlowConstants;

/**
 * 流程环节定义
 * @author 王浩 QQ：873987060   
 *
 */
public class YfWorkFlowDefine {
	
	public static int START_XMJL = 0;   //项目经理发起流程
	
	public static int START_YFJL = 1; //研发经理发起流程
	
	public static int START_ZRZXFZR = 3;  //研发中心负责人
	
	public static String[] yfmanage_one = {"yfmanager_one.apply","yfmanager_one.yfjl","yfmanager_one.yfzxfzr","yfmanager_one.fgfz"};
	
	public static String[] yfmanage_one_2 = {"yfmanager_one.apply","yfmanager_one.yfzxfzr","yfmanager_one.fgfz"};
	
	public static String[] yfmanage_one_3 = {"yfmanager_one.apply","yfmanager_one.fgfz"};
	
	
	public static String[] yfmanage_five = {"yfmanager_five.apply","yfmanager_five.yfjl","yfmanager_five.yfzxfzr","yfmanager_five.fgfz"};
	
	public static String[] yfmanage_five_2 = {"yfmanager_five.apply","yfmanager_five.yfzxfzr","yfmanager_five.fgfz"};
	
	public static String[] yfmanage_five_3 = {"yfmanager_five.apply","yfmanager_five.fgfz"};
	
	
	
	/**
	 * 获得前一活动ID
	 * @return
	 */
	public static String getPreActivityId(String activityId,int type){
		int node=1;
		String[] defineArray = null;
		if(StringUtils.isNotBlank(activityId)){
			if(type==START_XMJL){
				defineArray = yfmanage_one;
			}
			if(type==START_YFJL){
				defineArray = yfmanage_one_2;
			}
			if(type==START_ZRZXFZR){
				defineArray = yfmanage_one_3;
			}
			for (int i = 0; i < defineArray.length; i++) {
				if(defineArray[i].equals(activityId)){
					node = i;
				}
			}
		}
		return defineArray[node-1];
	}
	
	
	
	
	/**
	 * 获得前一活动ID (费用模块)
	 * @return
	 */
	public static String getPreActivityIdFEE(String activityId,int type){
		int node=1;
		String[] defineArray = null;
		if(StringUtils.isNotBlank(activityId)){
			if(type==START_XMJL){
				defineArray = yfmanage_five;
			}
			if(type==START_YFJL){
				defineArray = yfmanage_five_2;
			}
			if(type==START_ZRZXFZR){
				defineArray = yfmanage_five_3;
			}
			for (int i = 0; i < defineArray.length; i++) {
				if(defineArray[i].equals(activityId)){
					node = i;
				}
			}
		}
		return defineArray[node-1];
	}
	
	
	
	
	/**
	 * 获得前一活动ID
	 * @return
	 */
	public static String getPreActivityId(String activityId){
		return getPreActivityId(activityId,START_XMJL);
	}
	
	/**
	 * 根据节点名称得到当前节点的审批角色名
	 * @return
	 */
	public static String getRoleNameByActivityId(String activityId){
		String rname = "";
		if(activityId.equals("yfmanager_one.yfjl")){
			rname = WorkFlowConstants.ROLE_YFJL;
		}
		if(activityId.equals("yfmanager_one.yfzxfzr")){
			rname = WorkFlowConstants.ROLE_YFZXFZR;
		}
		if(activityId.equals("yfmanager_one.fgfz")){
			rname = WorkFlowConstants.ROLE_FGFZ;
		}
		return rname;
	}
	
	/**
	 * 根据节点名称得到当前节点的审批角色名
	 * @return
	 */
	public static String getRoleNameByActivityIdFEE(String activityId){
		String rname = "";
		if(activityId.equals("yfmanager_five.yfjl")){
			rname = WorkFlowConstants.ROLE_YFJL;
		}
		if(activityId.equals("yfmanager_five.yfzxfzr")){
			rname = WorkFlowConstants.ROLE_YFZXFZR;
		}
		if(activityId.equals("yfmanager_five.fgfz")){
			rname = WorkFlowConstants.ROLE_FGFZ;
		}
		return rname;
	}
	
	/**
	 * 根据节点名称得到当前节点的审批角色名
	 * @return
	 */
	public static String getRoleNameByActivityIdAccp(String activityId){
		String rname = "会审团会审";
		if(activityId.equals("yfmanager_three.shenpi")){
			rname = WorkFlowConstants.ROLE_YFJL;
		}
		if(activityId.equals("yfmanager_three.sp")){
			rname = WorkFlowConstants.ROLE_FGFZ;
		}
		return rname;
	}
}
